package com.xwltz.core.exception;

import com.xwltz.core.domain.ActionResult;
import com.xwltz.core.domain.SimpleActionResult;

/**
 * @description 业务异常
 * @information on version 1.0 be created by xwltz at 2021/12/29 16:38
 */

public class ServiceException extends BaseException {

	@SuppressWarnings("unused")
	public ServiceException(String message, Integer code) {
		this.message = message;
		this.code = code;
	}

	@SuppressWarnings("unused")
	public ServiceException(String msg, Exception e) {
		super(msg, e);
		this.message = msg;
	}

	@Override
	public String getExceptionName() {
		return this.message;
	}

	@Override
	public ActionResult<?> getResultInstance() {
		return ActionResult.error(getExceptionName());
	}

	@Override
	public SimpleActionResult getSimpleResultInstance() {
		return SimpleActionResult.error(getExceptionName());
	}
}
